import type { JSON2TypeOpt, RendererOptionsType } from "./util";

export const langs = [
  "ruby",
  "flow",
  "rust",
  "kotlin",
  "dart",
  "python",
  "c#",
  "go",
  "cpp",
  "java",
  "scala",
  "typescript",
  "swift",
  "object-c",
  "elm",
  "jsonSchema",
  "pike",
  "proptypes",
  "haskell",
  "php"
];

// 菜单配置
const menuConfig: CommonMenuType<JSON2TypeOpt & RendererOptionsType> = [
  {
    label: "生成的类型名",
    descript: "生成的类型名称",
    field: "typeName",
    type: "input"
  },
  {
    label: "目标语言",
    descript: "生成类型的目标语言",
    field: "lang",
    type: "enmu",
    list: langs.map(e => {
      return {
        label: e,
        value: e
      };
    })
  },
  {
    label: "缩进",
    descript: "文本缩进",
    field: "indentation",
    type: "enmu",
    list: [
      { label: "制表符", value: "\t" },
      { label: "两个空格", value: "  " },
      { label: "四个空格", value: "    " }
    ]
  },
  {
    label: "命名风格",
    descript: "变量命名风格",
    field: "acronym-style",
    type: "enmu",
    list: [
      { label: "原始值", value: "original" },
      { label: "大驼峰", value: "pascal" },
      { label: "驼峰式", value: "camel" },
      { label: "小写字母", value: "lowerCase" }
    ]
  },
  {
    label: "检测Date",
    descript: "开启检测Date类型",
    field: "inferDateTimes"
  },
  {
    label: "检测UUID",
    descript: "开启检测UUID类型",
    field: "inferUuids"
  },
  {
    label: "检测Enum",
    descript: "开启检测枚举类型",
    field: "inferEnums"
  },
  {
    label: "检测Map",
    descript: "开启检测Map类型",
    field: "inferMaps"
  },
  {
    label: "合并相识的类",
    descript: "合并相识的类",
    field: "combineClasses"
  },
  {
    label: "可选类型",
    descript: "生成类型的字段都是可选的",
    field: "allPropertiesOptional"
  },
  {
    label: "字母排序",
    descript: "使用字母排序, 否则JSON属性顺序",
    field: "alphabetizeProperties",
    isDivider: true
  },
  {
    label: "仅仅生成类型",
    descript: "只生成类型相关的文本",
    field: "just-types"
  },
  {
    label: "type 代替 interface",
    descript: "声明类型使用 type 代替 interface",
    field: "prefer-types"
  },
  {
    label: "属性名为js格式",
    descript: "将属性名称转换为javascript格式",
    field: "nice-property-names"
  },
  {
    label: "联合类型代替枚举",
    descript: "使用联合类型代替枚举",
    field: "prefer-unions"
  },
  {
    label: "单个值使用常量",
    descript: "对于单个值的字符串枚举, 使用字面量而不是枚举",
    field: "prefer-const-values"
  }
];

export default menuConfig;
